package com.rd.student.jiaji.class4.suyan.zrrd.homework2;

import java.util.Arrays;
import java.util.Random;

public class 练习2 {
    public static void main(String[] args) {
        int[] arr=new int[2];
        int index=0;
        while (true){
            Random random=new Random();
            int a=random.nextInt(12)+1;
            if (index==0){
                arr[index]=a;
                index++;
            }else{
                int result=0;
                for (int i=0;i<index;i++){
                    if (arr[i]==a){
                        result=1;
                        break;
                    }
                }
                if (result==0){
                    arr[index]=a;
                    index++;
                }
                if (index==2){
                    System.out.println(Arrays.toString(arr));
                    break;
                }
            }
        }
    }
}
